//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package nc.bs.gl.voucherbill.ace.bp;

import nc.bs.gl.voucherbill.plugin.bpplugin.VoucherbillPluginPoint;
import nc.bs.gl.voucherbill.rule.SendToJQRule;
import nc.bs.gl.voucherbill.rule.VoucherBillEffectRule;
import nc.bs.gl.voucherbill.rule.VoucherBillSendFIPMessgeRule;
import nc.bs.gl.voucherbill.rule.VoucherBillStateOfApproveRule;
import nc.impl.pubapp.pattern.data.bill.template.UpdateBPTemplate;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.gl.voucherbill.GLVoucherAggVO;

public class AceVoucherbillApproveBP {
    public AceVoucherbillApproveBP() {
    }

    public GLVoucherAggVO[] approve(GLVoucherAggVO[] clientBills, GLVoucherAggVO[] originBills) {
        UpdateBPTemplate<GLVoucherAggVO> bp = new UpdateBPTemplate(VoucherbillPluginPoint.APPROVE);
        this.addBeforeRule(bp.getAroundProcesser());
        this.addAfterRule(bp.getAroundProcesser());
        GLVoucherAggVO[] retvos = (GLVoucherAggVO[])bp.update(clientBills, originBills);
        return retvos;
    }

    private void addBeforeRule(CompareAroundProcesser<GLVoucherAggVO> processor) {
        IRule rule = new VoucherBillStateOfApproveRule();
        processor.addBeforeRule(rule);
    }

    private void addAfterRule(CompareAroundProcesser<GLVoucherAggVO> processor) {
        IRule rule = new VoucherBillSendFIPMessgeRule();
        processor.addAfterRule(rule);
        rule = new VoucherBillEffectRule();
        processor.addAfterRule(rule);
        rule = new SendToJQRule();
        processor.addAfterRule(rule);
    }
}
